<!-- parentComponent.vue -->
<template>
    <div>
      <child-component @userNotified="handleUserNotified"></child-component>
      
      <p>父组件接收到数据是：{{ sName }}</p>
     
    </div>
  </template>
  
  <script>
  import ChildComponent from './childComponent.vue'
  
  export default {
    components: {
      ChildComponent
    },
    data() {
      return {
        
        sName: ''
      }
    },
    methods: {
      
      handleUserNotified(userName) {
        this.sName = userName
        console.log(`${userName}已传递到父组件`)
      }
    }
  }
  </script>